package com.hertz.alarm.controller.api;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hertz.alarm.controller.BaseController;
import com.hertz.alarm.controller.support.ResultModel;
import com.hertz.alarm.entity.IrisUser;
import com.hertz.alarm.entity.MatchNba;
import com.hertz.alarm.service.IrisUserService;
@Controller
@RequestMapping("/api/user")
public class ApiUserController extends BaseController{
	@Resource
	private IrisUserService irisUserService;
	/*
	 * createOrLogin cl
	 */
	@RequestMapping(value="cl",method=RequestMethod.POST)
	public @ResponseBody ResultModel<Object> getUser(
			@RequestParam(required=true,value="ssoUserName") String ssoUserName,
			@RequestParam(required=true,value="ssoSite") String ssoSite){
		IrisUser irisUser = irisUserService.getOrCreateUser(ssoUserName, ssoSite);
		return buildResultModel(irisUser == null ? null : irisUser.getSsoToken());
	}
//	
}
